<?php
/**
 * 
 */
namespace Com\Test\event;

use Zend\EventManager\EventManagerAwareInterface;
use Zend\EventManager\EventManager;
use Zend\EventManager\EventManagerInterface;

class ownEvent implements EventManagerAwareInterface {

    protected $event;

    public function getEventManager() {
        if($this->event == null){
            $this->event = new EventManager();
        }
        return $this->event;
    }

    public function setEventManager(EventManagerInterface $eventManager) {
        $eventManager->setIdentifiers(array(__CLASS__, get_called_class()));
        $this->event = $eventManager;
        return $this;
    }
    
    public function log($arr=null){
    	echo "this is main thing!<br/>";
        print_r(get_called_class());
        $this->getEventManager()->trigger(__FUNCTION__,$this,$arr);
    }

}
?>

<!--protected function getMyEvent() {
    $outVar = 100;
    $myEvent = new \Com\Test\event\ownEvent();
    $myEvent->getEventManager()->attach('log', function($e)use($outVar) {
        $eventName = $e->getName();
        $target = get_class($e->getTarget());
        $par = $e->getParams();
        $data = array(
            'name' => $eventName,
            'target' => $target,
            'params' => $par
        );
        echo "<pre>";
        print_r($data);
        print_r($outVar);

    });

    $myEvent->log(array("one","two"));

}-->
